home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d11 / nansi22b.arc / NANSI.DOC < prev    next >
Text File  |  1987-12-03  |  9KB  |  207 lines

  1. Date:      Thu, 13 Feb 86 18:27:23 PST
  2. From:      kegel%Juliet.Caltech.Edu@Hamlet.Caltech.Edu
  3. Subject:  New ANSI driver, part 1 of 2
  4.  
  5.  
  6. Hi, folks.  Here's my console driver; the files are pretty long, and
  7. I apologize for simply stringing them together, but I'm not sure how
  8. else it could be sent.    This letter contains the documentation, the
  9. assembled driver (in hex, for loading with DEBUG), and some examples
  10. of how to set DOS RAW mode.  The following letter contains the five
  11. or so source files.  The source files are only needed if you want to
  12. make changes, or hunt down features or bugs.
  13.  
  14.  
  15. I admit, the source is pretty ugly some places; but it works well enough
  16. for my purposes.
  17.  
  18. So let me know what y'all think.
  19.  
  20.         - Daniel Kegel
  21. nansi    - enhanced MS-DOS ansi console driver
  22.  
  23. SYNOPSIS
  24.     Include in \config.sys the line
  25.         device=nansi.sys
  26.  
  27. DESCRIPTION
  28.     Nansi.sys is a console driver which understands ANSI control
  29.     sequences. It has several advantages over ANSI.SYS (the driver
  30.     supplied with DOS):
  31.     1. It supports new escape sequences (see below).
  32.     2. It provides MUCH faster output under certain conditions.
  33.     3. It supports the 43-line mode of the EGA.
  34.     4. The darned bell is now 1/4 second instead of 1/2 second long.
  35.  
  36.     What a console driver does:
  37.     When you, for example, type
  38.         C:> type foo.txt
  39.     COMMAND.COM opens the file foo.txt, reads it, and writes it to
  40.     the console driver, which puts it up on the screen.
  41.  
  42.     Both ansi.sys and nansi.sys use IBM Video BIOS to control the screen.
  43.     However, nansi.sys bypasses BIOS if the screen is in a text mode; this
  44.     allows much faster operation under certain conditions.
  45.  
  46.     While putting text up on the screen, (n)ansi.sys keeps a lookout for
  47.     the escape character (chr(27), known as ESC); this character signals
  48.     the start of a terminal control sequence.
  49.     Terminal control sequences follow the format
  50.         ESC [ param; param; ...; param cmd
  51.     where
  52.         ESC    is the escape character chr$(27).
  53.         [    is the left bracket character.
  54.         param    is an ASCII decimal number, or a string in quotes.
  55.         cmd    is a case-specific letter identifying the command.
  56.     Usually, zero, one, or two parameters are given.  If parameters
  57.     are omitted, they usually default to 1; however, some commands
  58.     (KKR and DKOCT) treat the no-parameter case specially.
  59.     Spaces are not allowed between parameters.
  60.  
  61.     For example, both ESC[1;1H and ESC[H send the cursor to the home
  62.     position (1,1), which is the upper left.
  63.  
  64.     Either single or double quotes may be used to quote a string.
  65.     Each character inside a quoted string is equivalent to one numeric
  66.     parameter.  Quoted strings are normally used only for the Keyboard
  67.     Key Reassignment command.
  68.  
  69. Control Sequences
  70.     The following table lists the sequences understood by nansi.sys.
  71.     Differences between nansi.sys and the standard ansi.sys are marked
  72.     with a vertical bar (|).
  73.  
  74. Cursor Positioning
  75. Short    Long name        Format        Notes
  76. CUP    cursor position     ESC[y;xH    Sets cursor position.
  77. HVP    cursor position     ESC[y;xf    Same as CUP; not recommended.
  78. CUU    cursor up        ESC[nA        n = # of lines to move
  79. CUD    cursor down        ESC[nB
  80. CUF    cursor forward        ESC[nC        n = # of columns to move
  81. CUB    cursor backward     ESC[nD
  82. DSR    Device Status, Report!    ESC[6n        Find out cursor position.
  83. CPR    Cursor Position report    ESC[y;xR    Response to DSR, as if typed.
  84. SCP    Save Cursor Position    ESC[s        Not nestable.
  85. RCP    Restore Cursor Position ESC[u
  86.  
  87. Editing
  88. ED    Erase in Display    ESC[2J    Clears screen.
  89. EL    Erase in Line        ESC[K    Clears to end of line.
  90. IL  |    Insert Lines        ESC[nL    Inserts n blank lines at cursor line.
  91. DL  |    Delete Lines        ESC[nM    Deletes n lines including cursor line.
  92. ICH |    Insert Characters    ESC[n@    Inserts n blank chars at cursor.
  93. DCH |    Delete Characters    ESC[nP    Deletes n chars including cursor char.
  94.  
  95.  
  96. Mode-Setting
  97. SGR    Set Graphics Rendition    ESC[n;n;...nm    See character attribute table.
  98. SM    Set Mode        ESC[=nh     See screen mode table.
  99. RM    Reset Mode        ESC[=nl     See screen mode table.
  100. IBMKKR    Keyboard Key Reass.    ESC["string"p
  101.     The first char of the string gives the key to redefine; the rest
  102.     of the string is the key's new value.
  103.     To specify unprintable chars, give the ASCII value of the char
  104.     outside of quotes, as a normal parameter.
  105.     IBM function keys are two byte strings; see the IBM Basic manual.
  106.     For instance, ESC[0;";dir a:";13;p redefines function key 1 to
  107.     have the value "dir a:" followed by the ENTER key.
  108.       | If no parameters given, all keys are reset to their default values.
  109.  
  110. DKOCT | Output char translate    ESC[n;ny
  111.       | When first char is encountered in output request, it is replaced with
  112.       | the second char.  This might be useful for previewing text before
  113.       | sending it to a printer with a funny print wheel.
  114.       | If no parameters are given, all chars are reset to normal.
  115.  
  116.  
  117. Character Attributes
  118.     The Set Graphics Rendition command is used to select foreground
  119.     and background colors or attributes.
  120.     When you use multiple parameters, they are executed in sequence, and
  121.     the effects are cumulative.
  122.        Attrib code        Value
  123.         0        All attributes off (normal white on black)
  124.         1        Bold
  125.         4        Underline
  126.         5        Blink
  127.         7        Reverse Video
  128.         8        Invisible (but why?)
  129.         30-37        foregnd blk/red/grn/yel/blu/magenta/cyan/white
  130.         40-47        background
  131.  
  132. Screen Modes
  133.     The IBM BIOS supports several video modes; the codes given in the
  134.     BIOS documentation are used as parameters to the Set Mode command.
  135.       | (In bitmap modes, the cursor is simulated with a small blob (^V).)
  136.         Mode Code        Value
  137.         0        text 40x25 Black & White
  138.         1        text 40x25 Color
  139.         2        text 80x25 Black & White
  140.         3        text 80x25 Color
  141.         4        bitmap 320x200 4 bits/pixel
  142.         5        bitmap 320x200 1 bit/pixel
  143.         6        bitmap 640x200 1 bit/pixel
  144.         7        (cursor wrap kludge)
  145.         13 (EGA)    bitmap 320x200 4 bits/pixel ?
  146.         14 (EGA)    bitmap 640x200 4 bits/pixel
  147.         16 (EGA)    bitmap 640x350 4 bits/pixel
  148.     Mode 7 is an unfortunate kludge; Setting mode 7 tells the cursor
  149.     to wrap around to the next line when it passes the end of a line;
  150.     Resetting mode 7 tells the cursor to not wrap, but rather stay put.
  151.       | If your computer has the Enhanced Graphics Adaptor, modes between
  152.       | 8 and 15 are also supported; see the EGA BIOS for info.
  153.       | The EGA also lets you use a shorter character cell in text modes
  154.       | in order to squeeze 43 lines of text out of the 25-line text modes.
  155.       | To enter 43 line mode, set the desired 25-line text mode (0 to 3),
  156.       | then Set Mode 43.  For instance: ESC[=3h ESC[=43h.
  157.       | To exit 43 line mode, set the desired 25-line text mode again.
  158.       | Nansi.sys ignores mode 43 unless there is an EGA on your computer.
  159.  
  160. Faster Output
  161.       | Any program that sets the console to RAW mode, and buffers its
  162.       | output properly, can achieve extremely high screen update speeds in
  163.       | return for giving up the special functions of the keys ^C, ^S, and ^P.
  164.       | See IOCTL in the MS-DOS 3.x Technical Reference for more info.
  165.     Also, a small improvement in speed may be noticed with some
  166.     programs that use the DOS console in normal mode, as this driver
  167.     efficiently implements the (standard but undocumented) INT 29h
  168.     most-favored-device putchar used by DOS.
  169.  
  170. EXAMPLES
  171.     See the file setraw.doc for Macro Assembler, Lattice C,
  172.     and Microsoft C routines for entering and leaving raw mode.
  173.  
  174. BUGS
  175.     Insert and delete character do not work in graphics modes.
  176.     Graphics mode writing is slow.
  177.     The simulated cursor in graphics mode slows down single-char
  178.     writes by a factor of 3; it should be disable-able.
  179.     Does not support erase-to-end-of-screen and other useful functions.
  180.  
  181. Version
  182.     This version, 2.2, created February 1986.  Problems should
  183.     be reported to Daniel Kegel, 1-60 CIT, Pasadena, CA 91126
  184.     (or, after June 1986, 2648 169th Ave SE, Bellevue, Wa. 98008).
  185.     Your suggestions for improvement would be most welcome.
  186.  
  187. NOTE
  188.     This program may be distributed for educational and personal use
  189.     only.  Commercial use is verboten; get in touch with the author.
  190.  
  191. FILES
  192.     nansi.doc    - this file
  193.     nansi    - makefile- shows how to assemble & link
  194.     nansis    - makefile- shows how to assemble & link
  195.     nansi.sys    - device driver
  196.     nansis.sys    - devide dirver for screens with snow
  197.     nansi.asm    - device driver guts
  198.     nansi_d.asm    - definitions
  199.     nansi_p.asm    - ANSI parameter grabber
  200.     nansi_f.asm    - ANSI function handlers
  201.     nansi_i.asm    - device driver init routine
  202.     setraw.cat    - concatenated examples
  203.     setraw.asm    - for assembly programs
  204.     setraw.msc    - for Microsoft C programs
  205.     setraw.lc    - for Lattice C programs
  206.     rawtest.lc    - example for Lattice C only
  207.